<?php

/**
 * model_finance
 */

class Model_finance extends YOU {

	public function __construct()
	{
		parent::__construct();
	}

		/** 读取总数 **/
	public function count()
	{
		$row = $this->db->fetchRow("SELECT COUNT(1) AS count FROM `tbl_finance`");
		return (int)$row['count'];
	}
	
	
	/** 读取成配置 **/
	public function getIni()
	{
		$finance_lists = $this->getAll();
		foreach ($finance_lists as $key => $value){
			$finance[$value['finance_id']] = $value['finance_name'];
		}

		return $finance;
	}

	/** 读取列表 **/
	public function getAll($field = "*")
	{
		$finance_lists = $this->db->fetchAll("SELECT {$field} FROM `tbl_finance` ");

		return $finance_lists;
	}

	/** 读取信息 **/
	public function getInfo($finance_id, $field = "*")
	{
		$data = $this->db->fetchRow("SELECT {$field} FROM `tbl_finance` WHERE finance_id='{$finance_id}' ");

		return $data;
	}
	/** 读取信息 **/
	public function getContInfo($finance_id, $field = "*")
	{
		$data = $this->db->fetchRow("SELECT {$field} FROM `tbl_financetable` WHERE finance_id='{$finance_id}' ");

		return $data;
	}
	
	
}



?>